# 第一阶段构建php
FROM debian:12.12-slim AS builder
ENV TZ=Asia/Shanghai
# 环境变量
ARG S_V
ADD swig-${S_V}.tar.gz /usr/local/
WORKDIR /usr/local/swig-${S_V}
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources && \
apt-get -y update && apt-get -y install build-essential libpcre2-dev zlib1g-dev python3 python3-dev && \
./configure --prefix=/usr/local/swig${S_V}  && \
make -j8 && make install
# 第二阶段
FROM debian:12.12-slim
ARG S_V
LABEL author=xiaoyilin
LABEL email=406735078@qq.com
ENV TZ=Asia/Shanghai
COPY --from=builder /usr/local/swig${S_V} /usr/local/swig${S_V}
ENV PATH=$PATH:/usr/local/swig${S_V}/bin
WORKDIR /usr/local/swig${S_V}
CMD ["swig","-help"]

# https://www.swig.org/Doc4.3/SWIGDocumentation.html#Preface_unix_installation
# https://www.swig.org/Doc4.3/SWIGDocumentation.html#Windows
# docker build --build-arg S_V=4.3.1 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/swig:4.3.1 .
# docker run --rm registry.cn-hangzhou.aliyuncs.com/xiaoyilin/swig:4.3.1
# docker run -it --rm registry.cn-hangzhou.aliyuncs.com/xiaoyilin/swig:4.3.1 bash
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/swig:4.3.1